package com.example.haojiutao.mapper;


import com.example.haojiutao.model.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description: 用户表持久层接口
 * @Author: cheng_jianzhen
 * @CreateTime: 2024/1/20 17:12
 */
@Mapper
@Repository
public interface UserMapper {
    /*
     * @Description: TODO
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:24
     * @param: user
     * @return: int 插入的记录数
     **/

    /*
     * @Description:  //注册用户
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:29
     * @param: user
     * @return: int
     **/
    int insert(User user);

    /*
     * @Description: //查询用户
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:34
     * @param: userId
     * @return: com.example.treasure_box.model.domain.User
     **/
    User selectById(Integer userId);

    /*
     * @Description: 修改用户
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:41
     * @param: user
     * @return: int
     **/
    int updateUser(User user);

    /*
     * @Description: //删除用户
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:48
     * @param: userId
     * @return: com.example.treasure_box.model.domain.User
     **/
    int deleteById(Integer userId);

    /*
     * @Description: //分页列表查询
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:50
     * @param: user
     * @return: java.util.List<com.example.treasure_box.model.domain.User>
     **/
    List<User> selectListByUser(User user);

    /*
     * @Description: 注册用户
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 17:56
     * @param: user
     * @return: java.util.List<com.example.treasure_box.model.domain.User>
     **/
    int selectCountByUserName(String userName);


    /*
     * @Description: 根据手机号,密码查询符合条件的用户,用于登录
     * @Author: cheng_jianzhen
     * @CreateTime: 2024/1/20 18:01
     * @param: phone
     * @param: password
     * @return: com.example.treasure_box.model.domain.User
     **/
    User selectByPhonePassword(String phoneNum, String userPwd);

    List<User> selectRecommendUseravg(User user);

    int insertuser(User user);

    User selectByName(String userName);
}
